package com.requestfactory.wire.echo;

import java.io.IOException;
import java.math.BigDecimal;

import org.apache.commons.httpclient.HttpException;

public class EchoServiceImpl implements EchoService {

	@Override
	public String echo(String value) {
		return value;
	}

	@Override
	public int divide(int left, int right) { 
		return left / right;
	}

	@Override
	public String throwHttpException(String message) 
	throws HttpException {
		throw new HttpException(message);
	}

	@Override
	public double throwIllegalArgumentException(float f, String message)
	throws IllegalArgumentException {
		throw new IllegalArgumentException(message,
				new RuntimeException(message));
	}

	@Override
	public long throwIOException(Integer I, int i, String message)
	throws IOException {
		throw new IOException(message);
	}

	@Override
	public void throwEchoServiceException() 
	throws EchoServiceException {
		throw new EchoServiceException("hello", new Exception());
	}

	@Override
	public BigDecimal primitives(byte b, short sh, char ch, int i, long l,
			float f, double d) {
		double sum = b + sh + ch + i + l + f + d;
		return new BigDecimal(sum);
	}

}
